package day03.io;

//import java.io.FileOutputStream;
//import java.io.IOException;
//import java.io.InputStreamReader;
import java.io.*;
import java.nio.charset.StandardCharsets;

//使用字符流读取字符
public class ISRDemo {
    public static void main(String[] args) throws IOException {
        FileInputStream fis=new FileInputStream("osw.txt");
        InputStreamReader isr=new InputStreamReader(fis, "UTF-8");
//        isr.read();
        /*读取一个字符，返回的int实际上是char。但如果返回的int对应的整数为-1则表示流读取到了末尾*/
        int d;
        while((d=isr.read())!=-1){
            System.out.println((char) d);
        }
        isr.close();
    }
}
